<template>
    <div>
        <h3>Child</h3>
        <h5>{{msg}}</h5>
        <button @click="passMsg">带你就</button>
        <h6>{{transMsg}}</h6>
    </div>
</template>

<script>
import bus from '../util/bus'
    export default {
        props:{
            msg:{
                type:String,
                default:''
            },
        },
        data() {
            return {
                transMsg: ''
            }
        },
        mounted () {
            // console.log(this.$parent.parentMethod());
            bus.$on('AppTransMsg',(val)=>{
                this.transMsg=val
            })
            // console.log(this.$attrs);
        },
        methods: {
            passMsg() {
                this.$emit('showMsg','i am from child')
            }
        },
    }
</script>

<style  scoped>

</style>